package com.axun.ckz.yytmanager.module;

import android.content.Context;
import android.text.TextUtils;

import com.axun.ckz.yytmanager.app.MyApp;
import com.axun.ckz.yytmanager.base.IBaseXm;
import com.axun.ckz.yytmanager.net.URL;
import com.axun.ckz.yytmanager.util.SPUtils;
import com.axun.ckz.yytmanager.util.UserShare;

public class WelcomeMd extends IBaseXm implements WelcomeModule {
    private Context context;

    public WelcomeMd(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public void setUserInfo() {
        String userId = UserShare.getInstance(context).getUserId();
        String userName = UserShare.getInstance(context).getStringValue("userName");
        int accountId = UserShare.getInstance(context).getIntValue("accountId");
        String sessionId = UserShare.getInstance(context).getStringValue("sessionId");
        MyApp.User.userId = userId;
        MyApp.User.userName = userName;
        MyApp.User.accountId = accountId;
        MyApp.User.sessionId = sessionId;
    }

    @Override
    public void setServiceUrl() {
        String url = SPUtils.getStringSp(context,"url");
        if (!TextUtils.isEmpty(url)){
            URL.DOMAIN = url;
        }
        String code = SPUtils.getStringSp(context,"code");
       if (!TextUtils.isEmpty(code)){
           MyApp.code = code;
       }

    }
}
